<?php

namespace App\Http\Controllers\api;

use App\Http\Controllers\Controller;
use App\Repository\RepositoryInterface\UserLoginInterface;
use Illuminate\Http\Request;
//前台用户注册类
class UserLoginController extends Controller
{
    //
    protected $userLogin;

    public function __construct(UserLoginInterface $userLogin){
        $this->userLogin = $userLogin;
    }

    /**
     * @param Request $request
     * 发送验证码
     */
    public function sendCode(Request $request){
        $phone=$request->get('phone');
        $this->userLogin->sendCode($phone);
    }

    /**
     * @param Request $request
     * 用户注册方法
     */
    public function register(Request $request){
        $register_data=$request->post();
        $this->userLogin->userRegister($register_data);
    }

    /**
     * @param Request $request
     * 校验用户登录的账号密码方法
     */
    public function verify(Request $request){
        $data=$request->post();
        $this->userLogin->verify($data);
    }

    /**
     * @param Request $request
     * 修改用户信息
     */
    public function upUserInfo(Request $request){
        $user_data=$request->post();
        $this->userLogin->upUserInfo($user_data);
    }
}
